// Copyright 2019 Aleksander Woźniak
// SPDX-License-Identifier: Apache-2.0
int getHashCode(DateTime key) {
  return key.day * 1000000 + key.month * 10000 + key.year;
}

final kToday = DateTime.now();
final kFirstDay = DateTime(kToday.year, kToday.month - 12, kToday.day);
final kLastDay = DateTime(kToday.year, kToday.month + 12, kToday.day);

///计算时间区间,天数
List<DateTime> daysInRange(DateTime first, DateTime last) {
  final dayCount = last.difference(first).inDays + 1;
  return List.generate(
    dayCount, (index) => DateTime.utc(first.year, first.month, first.day + index),
  );
}

bool isHisCanSelect(DateTime? a, DateTime? b) {
  if (a == null || b == null) {
    return false;
  }
  return b.isBefore(a);
}
///判断是否是当月最后一天
bool isLastDayOfMonth() {
  return DateTime(kToday.year, kToday.month, kToday.day + 1).day == 1;
}
///判断是否位于当前月之前
bool isBeforeCurrentMonth(DateTime? dateTime){
  if (dateTime == null) {
    return false;
  }
  return dateTime.year <= kToday.year && dateTime.month < kToday.month;
}
